package genetic.q3.functions;

import genetic.Function;
import genetic.TreeNode;

public class Plus extends SymbolicRegressionFunction{

	public Plus() {
		super(null);
	}

	public Plus(TreeNode[] kids) {
		super(kids);
	}

	@Override
	public Function createInstance(TreeNode[] kids) {
		return new Plus(kids);
	}

	@Override
	public TreeNode createRandomInstance(TreeNode[] kids) {
		return new Plus(kids);
	}

	@Override
	public int getNumKids() {
		return 2;
	}

	@Override
	public String getName() {
		return "+";
	}

	@Override
	public double compute(double xVal) {
		double val1 = ((Computable)kids[0]).compute(xVal);
		double val2 = ((Computable)kids[1]).compute(xVal);
		return val1+val2;
	}

}
